from django.db.models import Manager
from datetime import datetime


class LivePostManager(Manager):
  """ Only show published posts """
  def get_query_set(self):
    return super(LivePostManager, self).get_query_set().filter(status__gte=2).exclude(publish__gte=datetime.now())


class ManagerWithPublished(Manager):
  """ Same as above but for more for templates """
  def published(self):
    return self.get_query_set().filter(status__gte=2).exclude(publish__gte=datetime.now())